<div id="SIGNIN">
<?php 
//if a user is signed in
if (isset($user) && $user!=null){
	echo "Signed in as <a href='$page_editprofile' target=_self>".$user['loginname']."</a>" . " | ";
	if (!(isset($game['gameid']) && $game['gameid']!=null)){
		if ($user['lastcreatedgameid']){
			$gameid = $user['lastcreatedgameid'];
			echo " <a href='$game_join&gameid=$gameid' target=_self>Created game</a> | ";
		}
		if ($user['lastplayedgameid']){
			$gameid = $user['lastplayedgameid'];
			echo " <a href='$game_join&gameid=$gameid' target=_self>Last played game</a> | ";
		}
	} else {
		$gamename = $game['gamename'];
		$gameid=$game['gameid'];
		echo " Playing Sudoku in <a href='$game_join&gameid=$gameid' target=_self>$gamename</a> | ";
	}
	echo "<a href='$user_signout' target=_self>Sign out</a>";
} else {
	//no user signed in
	echo "<a href='$page_signin' target=_self>Sign in</a> | <a href='$page_signup' target=_self>Sign up</a>";
}?>
</div>